load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "upgrades",
    srcs = [
        "descriptor_utils.go",
        "first_upgrade.go",
        "permanent_create_jobs_metrics_polling_job.go",
        "permanent_ensure_sql_schema_telemetry_schedule.go",
        "permanent_key_visualizer_migration.go",
        "permanent_mvcc_statistics_migration.go",
        "permanent_sql_stats_ttl.go",
        "permanent_system_activity_update_job.go",
        "permanent_upgrades.go",
        "redacted_stmt_diagnostics_requests.go",
        "schema_changes.go",
        "upgrades.go",
        "v24_2_delete_version_tenant_settings.go",
        "v24_2_tenant_rates.go",
        "v24_2_tenant_system_tables.go",
        "v24_3_add_timeseries_zone_config.go",
        "v24_3_table_metadata_system_table.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/upgrade/upgrades",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/clusterversion",
        "//pkg/jobs",
        "//pkg/jobs/jobspb",
        "//pkg/jobs/metricspoller",
        "//pkg/keys",
        "//pkg/keyvisualizer/keyvisjob",
        "//pkg/kv",
        "//pkg/roachpb",
        "//pkg/security/username",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/catalogkeys",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/catalog/descidgen",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/catalog/nstree",
        "//pkg/sql/catalog/schematelemetry/schematelemetrycontroller",
        "//pkg/sql/catalog/systemschema",
        "//pkg/sql/catalog/tabledesc",
        "//pkg/sql/isql",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sessiondata",
        "//pkg/upgrade",
        "//pkg/upgrade/upgradebase",
        "//pkg/util/envutil",
        "//pkg/util/log",
        "//pkg/util/protoutil",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_kr_pretty//:pretty",
    ],
)

go_test(
    name = "upgrades_test",
    size = "large",
    srcs = [
        "builtins_test.go",
        "descriptor_utils_test.go",
        "first_upgrade_test.go",
        "helpers_test.go",
        "main_test.go",
        "permanent_create_jobs_metrics_polling_job_test.go",
        "permanent_ensure_sql_schema_telemetry_schedule_test.go",
        "permanent_mvcc_statistics_migration_test.go",
        "permanent_sql_stats_ttl_test.go",
        "permanent_system_activity_update_job_test.go",
        "redacted_stmt_diagnostics_requests_test.go",
        "schema_changes_external_test.go",
        "schema_changes_helpers_test.go",
        "upgrades_test.go",
        "v24_2_delete_version_tenant_settings_test.go",
        "v24_2_tenant_rates_test.go",
        "v24_2_tenant_system_tables_test.go",
        "v24_3_table_metadata_system_table_test.go",
        "version_starvation_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":upgrades"],
    shard_count = 16,
    deps = [
        "//pkg/base",
        "//pkg/clusterversion",
        "//pkg/jobs",
        "//pkg/jobs/jobspb",
        "//pkg/jobs/jobstest",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/roachpb",
        "//pkg/scheduledjobs",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/security/username",
        "//pkg/server",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/catalogkeys",
        "//pkg/sql/catalog/catenumpb",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/catalog/descbuilder",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/catalog/desctestutils",
        "//pkg/sql/catalog/funcdesc",
        "//pkg/sql/catalog/lease",
        "//pkg/sql/catalog/schemadesc",
        "//pkg/sql/catalog/schematelemetry/schematelemetrycontroller",
        "//pkg/sql/catalog/systemschema",
        "//pkg/sql/catalog/tabledesc",
        "//pkg/sql/isql",
        "//pkg/sql/privilege",
        "//pkg/sql/sem/builtins/builtinconstants",
        "//pkg/sql/sem/tree",
        "//pkg/sql/types",
        "//pkg/testutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/skip",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/testcluster",
        "//pkg/upgrade",
        "//pkg/upgrade/upgradebase",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/protoutil",
        "//pkg/util/retry",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_cockroach_go_v2//crdb",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
    ],
)
